package com.example.springbootpetstoredemo.Mapper;

import com.example.springbootpetstoredemo.Pojo.Item;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface ItemMapper {

    List<Item> getItemListByProductId(@Param("productId")String productId);

    List<Item> getItemListByCategoryId(@Param("categoryId")String categoryId);

    List<Item> getItemList();

    Item getItem(@Param("itemId") int itemId);

    //新增商品
    void addItem(@Param("categoryId")String categoryId, @Param("name")String name, @Param("quantity")int quantity,
                 @Param("unitPrice")BigDecimal unitPrice,@Param("description")String description,@Param("state")String state,@Param("limit")String limit);

    //修改商品
    void editItem(@Param("oldName")String oldName, @Param("quantity")int quantity,
                 @Param("description")String description,@Param("state")String state,@Param("limit")String limit,@Param("newName")String newName,@Param("unitPrice")BigDecimal unitPrice);

    //删除商品
    void deleteItem(@Param("itemId")int itemId);

    //通过名字删除商品
    void deleteItemByName(@Param("itemName")String itemName);

    //删除所有商品
    void deleteCategory(@Param("categoryId")String categoryId);

}
